import {
	JSEncrypt
} from '@/common/jsencrypt.js' // 基于rsa的加密解密库， 文件内容太长，需要的请前往我的码云仓库获取
import Vue from 'vue'
// 加密公钥
const key = Vue.prototype.publicKey // 找后端给

// 加密
export function rsaEncrypt(msg) {
	const jsencrypt = new JSEncrypt()
	jsencrypt.setPublicKey(key)
	const encryptMsg = jsencrypt.encryptLong(msg)
	return encryptMsg
}

// 解密私钥
const privateKey =
	`` // 找后端给
// 解密
export function rsaDecrypt(msg) {
	const decrypt = new JSEncrypt()
	decrypt.setPrivateKey(privateKey)
	const decryptMsg = decrypt.decryptLong(msg)
	return decryptMsg
}
